<template>
    <div id="friend-merchant-manage" class="w-h-100 pos-r flex-1 apply-container"
        style="box-sizing: border-box; overflow: hidden">
        <div class="w-h-100 ver-flex pos-a" style="box-sizing: border-box; padding: 6px">
            <div class="search-s page-public-s" style="box-sizing: border-box">
                <el-card shadow="never" :body-style="{ paddingBottom: '0' }">
                    <el-form class="box-f" ref="queryForm" :inline="true">
                        <el-form-item>
                            <el-button v-if="$hasPer('enterpriseQualification1:add')" @click="nodeClick" icon="ele-Plus"
                                type="primary"> 新增 </el-button>
                            <el-button v-if="$hasPer('enterpriseQualification2:excel')" @click="handleExport"
                                icon="ele-Download"> 导出数据 </el-button>
                        </el-form-item>
                    </el-form>
                </el-card>
            </div>

            <div style="box-sizing: border-box" class="flex-1 pos-r">
                <div class="pos-a w-h-100" style="box-sizing: border-box">
                    <el-card class="box-card w-h-100" shadow="never" style="margin-top: 16px">
                        <div style="" class="w-h-100 ver-flex">
                            <div class="flex-1 pos-r">
                                <div class="pos-a w-h-100">
                                    <el-table ref="excelRef" :data="list" class="w-h-100" style="width: 100%" border
                                        v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.5)">
                                        <el-table-column type="index" label="序号" width="55"
                                            :show-overflow-tooltip="true" align="center" :index="indexMethod" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true" label="许可证类型"
                                            align="center">
                                            <el-table-column min-width="120" :show-overflow-tooltip="true"
                                                align="center">
                                                <template #header>
                                                    <SearchModel typeId="n_Type" typeVal="select"
                                                        @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="{ row }">
                                                    {{ row.v_TypeName }}
                                                </template>
                                            </el-table-column>
                                        </el-table-column>
                                        <template v-if="Number(ruleForm.n_Type) == 99">
                                            <el-table-column min-width="120" :show-overflow-tooltip="true" label="许可证名称"
                                                align="center">
                                                <template #default="scope">
                                                    <span v-if="scope.row.v_Name">{{ scope.row.v_Name }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                            </el-table-column>
                                        </template>
                                        <el-table-column min-width="120" :show-overflow-tooltip="true" label="许可证编号"
                                            align="center">
                                            <el-table-column min-width="120" :show-overflow-tooltip="true"
                                                align="center">
                                                <template #header>
                                                    <SearchModel typeId="v_NO" typeVal="input"
                                                        @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="{ row }">
                                                    {{ row.v_NO }}
                                                </template>
                                            </el-table-column>
                                        </el-table-column>
                                        <el-table-column min-width="120" :show-overflow-tooltip="true" label="资质等级"
                                            align="center">
                                            <el-table-column min-width="120" :show-overflow-tooltip="true"
                                                align="center">
                                                <template #header>
                                                    <SearchModel typeId="v_Gade" typeVal="input"
                                                        @searchHandel="searchHandel" :basicsInfo="basicsInfo" />
                                                </template>
                                                <template #default="{ row }">
                                                    {{ row.v_Gade ? row.v_Gade : '-' }}
                                                </template>
                                            </el-table-column>
                                        </el-table-column>
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            label="许可范围" align="center">
                                            <template #default="scope">
                                                    <span v-if="scope.row.v_Scope">{{ scope.row.v_Scope }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                        </el-table-column>
                                        <!-- <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="v_Authority" label="发证机关" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="d_IssueDate" label="发证日期" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="d_ValidityDate" label="有效期" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="d_ReviewDate" label="复审日期" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="d_LastDSTime" label="最后一次数据同步时间" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="d_InitiateDSTime" label="发起同步时间" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true" prop="isTobeDS"
                                            label="待同步至双控" align="center">
                                            <template #default="{ row }">
                                                {{ row.isTobeDS ? '是' : '否' }}
                                            </template>
                                        </el-table-column> -->
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            label="备注" align="center">
                                            <template #default="scope">
                                                    <span v-if="scope.row.v_Remark">{{ scope.row.v_Remark }}</span>
                                                    <span v-else> - </span>
                                                </template>
                                        </el-table-column>
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="createdTime" label="创建时间" align="center" />
                                        <el-table-column min-width="100" :show-overflow-tooltip="true"
                                            prop="createdUserName" label="创建人" align="center" />
                                        <el-table-column min-width="120" :show-overflow-tooltip="true"
                                            prop="updatedTime" label="更新时间" align="center">
                                            <template #default="scope">
                                                <span v-if="scope.row.updatedTime">{{ scope.row.updatedTime }}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>
                                        <el-table-column min-width="100" :show-overflow-tooltip="true"
                                            prop="updatedUserName" label="更新人" align="center">
                                            <template #default="scope">
                                                <span v-if="scope.row.updatedUserName">{{ scope.row.updatedUserName
                                                    }}</span>
                                                <span v-else> - </span>
                                            </template>
                                        </el-table-column>
                                        <el-table-column min-width="140" label="操作" align="center" fixed="right">
                                            <el-table-column min-width="240" fixed="right" align="center">
                                                <template #header>
                                                    <el-button @click="searchClick" icon="ele-Search" type="primary"
                                                        text> 查询 </el-button>
                                                    <el-button @click="resetClick" icon="ele-Refresh" text> 重置
                                                    </el-button>
                                                </template>
                                                <template #default="scope">
                                                    <div class="operate-s">
                                                        <el-button v-if="$hasPer('enterpriseQualification3:edit')"
                                                            @click="nodeClick(scope.row)" class="icon-e" icon="ele-Edit"
                                                            size="small" text type="primary"> 编辑</el-button>
                                                        <el-button v-if="$hasPer('enterpriseQualification4:detail')"
                                                            @click="editIdInfoHandler(scope.row.id)" class="icon-e"
                                                            icon="ele-Edit" size="small" text type="success">
                                                            详情</el-button>
                                                        <el-button v-if="$hasPer('enterpriseQualification5:create')"
                                                            size="small" @click="documentClick(scope.row)" text
                                                            type="primary"> 附件管理 </el-button>
                                                        <el-button v-if="$hasPer('enterpriseQualification6:delete')"
                                                            @click="deleteHandle(scope.row.id)" class="icon-e"
                                                            icon="ele-Delete" size="small" text type="danger">
                                                            删除
                                                        </el-button>
                                                    </div>
                                                </template>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table>
                                </div>
                            </div>
                            <div style="height: 30px; margin-top: 20px" class="hr-flex-start">
                                <el-pagination v-model:currentPage="pageNo" v-model:page-size="pageSize"
                                    :total="totalRows" :page-sizes="[10, 20, 50, 100]" small background
                                    @size-change="handleSizeChange" @current-change="handleCurrentChange"
                                    layout="total, sizes, prev, pager, next, jumper" class="w-h-100" />
                            </div>
                        </div>
                    </el-card>
                </div>
            </div>
        </div>
        <!-- 新增and编辑 -->
        <el-dialog draggable :close-on-click-modal="false" :close-on-press-escape="false" v-model="showDialogVisible"
            :title="editId ? '编辑' : '新增'" width="50%" @close="cancelUseClick">
            <el-form :model="ruleForm" label-width="120px" ref="formRef" :rules="rules">
                <el-divider content-position="left"> 基本信息 </el-divider>
                <el-row :gutter="35">
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item prop="n_Type" label="许可证类型">
                            <el-select v-model="ruleForm.n_Type" placeholder="许可证类型" clearable style="width: 100%">
                                <el-option v-for="item in licenceList" :key="item.value" :label="item.label"
                                    :value="item.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="许可证名称">
                            <el-input v-model="ruleForm.v_Name" placeholder="许可证名称" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item prop="v_NO" label="许可证编号">
                            <el-input v-model="ruleForm.v_NO" placeholder="许可证编号" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="资质等级">
                            <el-input v-model="ruleForm.v_Gade" placeholder="资质等级" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="许可范围">
                            <el-input v-model="ruleForm.v_Scope" placeholder="许可范围" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item prop="v_Authority" label="发证机关">
                            <el-input v-model="ruleForm.v_Authority" placeholder="发证机关" clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item prop="d_IssueDate" label="发证日期">
                            <el-date-picker v-model="ruleForm.d_IssueDate" type="date" format="YYYY/MM/DD"
                                style="width: 100%" value-format="YYYY/MM/DD" placeholder="发证日期" />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item prop="d_ValidityDate" label="有效期">
                            <el-date-picker v-model="ruleForm.d_ValidityDate" type="date" format="YYYY/MM/DD"
                                style="width: 100%" value-format="YYYY/MM/DD" placeholder="有效期" />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="复审日期">
                            <el-date-picker v-model="ruleForm.d_ReviewDate" type="date" format="YYYY/MM/DD"
                                style="width: 100%" value-format="YYYY/MM/DD" placeholder="复审日期" />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="备注">
                            <el-input v-model="ruleForm.v_Remark" placeholder="备注" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="cancelUseClick">取消</el-button>
                    <el-button type="primary" @click="controlUseClick(formRef)">确定</el-button>
                </span>
            </template>
        </el-dialog>
        <!-- 详情 -->
        <el-dialog draggable :close-on-click-modal="false" :close-on-press-escape="false"
            v-model="showDialogVisibleInfo" title="详情" width="50%" @close="showDialogVisibleInfo = false">
            <el-descriptions title="" border :column="2">
                <el-descriptions-item>
                    <template #label> 记录Id </template> {{ qualificationDetail.id }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 许可证类型名称 </template> {{ qualificationDetail.v_TypeName }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 许可证名称 </template> {{ qualificationDetail.v_Name }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 许可证编号 </template> {{ qualificationDetail.v_NO }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 资质等级 </template> {{ qualificationDetail.v_Gade }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 许可范围 </template> {{ qualificationDetail.v_Scope }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 发证机关 </template> {{ qualificationDetail.v_Authority }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 发证日期 </template> {{ qualificationDetail.d_IssueDate }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 有效期 </template> {{ qualificationDetail.d_ValidityDate }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 复审日期 </template> {{ qualificationDetail.d_ReviewDate }}
                </el-descriptions-item>
                <!-- <el-descriptions-item>
                    <template #label> 文件Id </template> {{ qualificationDetail.l_FileId }}
                </el-descriptions-item> -->
                <el-descriptions-item>
                    <template #label> 备注 </template> {{ qualificationDetail.v_Remark }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 最后一次数据同步时间 </template> {{ qualificationDetail.d_LastDSTime }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 发起同步时间 </template> {{ qualificationDetail.d_InitiateDSTime }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 待同步至双控 </template> {{ qualificationDetail.isTobeDS ? '是' : '否' }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 创建时间 </template> {{ qualificationDetail.createdTime }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 创建人 </template> {{ qualificationDetail.createdUserName }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 更新时间 </template> {{ qualificationDetail.updatedTime }}
                </el-descriptions-item>
                <el-descriptions-item>
                    <template #label> 更新人 </template> {{ qualificationDetail.updatedUserName }}
                </el-descriptions-item>
            </el-descriptions>
        </el-dialog>
        <!-- 文件 -->
        <uploadFile isAccept="" :fileInfo="fileInfo" :isUseDialog="fileDialog" @cancelFileClick="cancelFileClick"
            @controlFileClick="controlFileClick" />
    </div>
</template>
<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue';
import getTableData from '/@/utils/getTableData';
import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
import SearchModel from '/@/views/oms/component/search-model.vue';
import { exportToExcel } from '/@/utils/exportToExcel';
import { getQualificationPageListApi, getQualificationListApi, createQualificationApi, updateQualificationApi, deleteQualificationApi, getQualificationDetailApi, getSnowflakeIdApi } from '/@/api/centerControl/oms';
import uploadFile from '/@/views/oms/component/reviseUploadFile.vue'
//#region 获取数据
//查询字段
let searchObj: any = reactive({});
//查询
const basicsInfo: any = ref([]);
const initInfoFun = () => {
    basicsInfo.value = [
        {
            typeId: 'n_Type', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
            typeNam: '', // 输入类型(number,text等) --- 选填
            searchVal: 'n_Type', // 查询字段 --- 必填
            defaultVal: '', // 字段默认值 --- 选填
            placeholder: '许可证类型', // placeholder数据
            defaultProp: licenceList, // 下拉框中使用，除下拉框外其它情况为空 --- 选填
            eventType: '', // 事件类型（如burl/change等） --- 选填
            defaultEvent: '', // 事件名称 --- 选填
        },
        {
            typeId: 'v_NO', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
            typeNam: '', // 输入类型(number,text等) --- 选填
            searchVal: 'v_NO', // 查询字段 --- 必填
            defaultVal: '', // 字段默认值 --- 选填
            placeholder: '许可证编号', // placeholder数据
            defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
            eventType: '', // 事件类型（如burl/change等） --- 选填
            defaultEvent: '', // 事件名称 --- 选填
        },
        {
            typeId: 'v_Gade', // 类型(不能为空，且唯一，与组件中typeId值对应) --- 必填
            typeNam: '', // 输入类型(number,text等) --- 选填
            searchVal: 'v_Gade', // 查询字段 --- 必填
            defaultVal: '', // 字段默认值 --- 选填
            placeholder: '资质等级', // placeholder数据
            defaultProp: '', // 下拉框中使用，除下拉框外其它情况为空 --- 选填
            eventType: '', // 事件类型（如burl/change等） --- 选填
            defaultEvent: '', // 事件名称 --- 选填
        },
    ];
};

const searInfo: any = ref();
const searchHandel = (val: any) => {
    searInfo.value = val;
};
const searchClick = () => {
    // searchObj.ProviderName = transferVal.value
    let newObj = Object.keys(searInfo.value);
    if (newObj.length !== 0) {
        newObj.map((i: any) => {
            searchObj[i] = searInfo.value[i];
        });
    }
};
//重置
const resetClick = () => {
    searInfo.value = {};
    let newObj = Object.keys(searchObj);
    if (newObj.length !== 0) {
        newObj.map((i: any) => {
            searchObj[i] = '';
            // console.log(i);
        });
    }
    initInfoFun();
};
//#endregion

//#region 新增/编辑/表单校验
//许可证类型
const licenceList = [
    { value: 0, label: '营业执照' },
    { value: 1, label: '危险化学品安全生产许可证' },
    { value: 2, label: '危险化学品经营许可证' },
    { value: 3, label: '危险化学品登记证' },
    { value: 4, label: '安全生产标准化证书或公告文件' },
    { value: 99, label: '其他' },
];
// 表单字段
const ruleForm = reactive({
    n_Type: '',//许可证类型  *
    v_Name: '',//许可证名称(如果许可证类型为99 其他，该字段不能为空)
    v_NO: '',//许可证编号  *
    v_Gade: '',//资质等级
    v_Scope: '',//许可范围
    v_Authority: '',//发证机关  *
    d_IssueDate: '',//发证日期  *
    d_ValidityDate: '',//有效期  *
    d_ReviewDate: '',//复审日期
    l_FileId: 0,//
    v_Remark: '',//备注
});
// 表单校验
const formRef = ref<FormInstance>();
const rules = reactive({
    n_Type: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
    v_NO: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
    v_Authority: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
    d_IssueDate: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
    d_ValidityDate: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
});
// 新增/编辑
const showDialogVisible = ref(false);
const editId = ref(0);
const nodeClick = async (obj: any) => {
    if (obj.id) {
        editId.value = obj.id;
        ruleForm.n_Type = obj.n_Type;//许可证类型  *
        ruleForm.v_Name = obj.v_Name;//许可证名称(如果许可证类型为99 其他，该字段不能为空)
        ruleForm.v_NO = obj.v_NO;//许可证编号  *
        ruleForm.v_Gade = obj.v_Gade;//资质等级
        ruleForm.v_Scope = obj.v_Scope;//许可范围
        ruleForm.v_Authority = obj.v_Authority;//发证机关  *
        ruleForm.d_IssueDate = obj.d_IssueDate;//发证日期  *
        ruleForm.d_ValidityDate = obj.d_ValidityDate;//有效期  *
        ruleForm.d_ReviewDate = obj.d_ReviewDate;//复审日期
        ruleForm.v_Remark = obj.v_Remark;//备注
        ruleForm.l_FileId = obj.l_FileId;
    } else {
        const res = await getSnowflakeIdApi()
        ruleForm.l_FileId = res.data
    }
    showDialogVisible.value = true;
};
//取消
const cancelUseClick = () => {
    showDialogVisible.value = false;
    formRef.value?.resetFields();
    editId.value = 0;
    ruleForm.n_Type = '';
    ruleForm.v_Name = '';
    ruleForm.v_NO = '';
    ruleForm.v_Gade = '';
    ruleForm.v_Scope = '';
    ruleForm.v_Authority = '';
    ruleForm.d_IssueDate = '';
    ruleForm.d_ValidityDate = '';
    ruleForm.d_ReviewDate = '';
    ruleForm.v_Remark = '';
    ruleForm.l_FileId = 0;
};
//表单提交
const controlUseClick = async (formEl: FormInstance | undefined) => {
    if (!formEl) return;
    await formEl.validate((valid, fields) => {
        if (valid) {
            console.log('submit!');
            if (editId.value) {
                updateQualificationApi({ ...ruleForm, id: editId.value }).then((res: any) => {
                    console.log(res, 'res');
                    cancelUseClick();
                    getData();
                });
            } else {
                const obj = Object.assign({ ...ruleForm, N_Id: 0 });
                createQualificationApi(obj).then((res: any) => {
                    console.log(res, 'res');
                    cancelUseClick();
                    getData();
                });
            }
        } else {
            console.log('error submit!', fields);
        }
    });
};
//#endregion

//#region  详情
const showDialogVisibleInfo = ref(false);
const qualificationDetail = ref()
const editIdInfoHandler = async (num: number) => {
    const res = await getQualificationDetailApi({ id: num })
    qualificationDetail.value = res.data
    showDialogVisibleInfo.value = true
};
//#endregion

//删除
const deleteHandle = async (val: String | Number) => {
    ElMessageBox.confirm('请确定是否删除此条数据', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
    })
        .then(async () => {
            let param = { id: val };
            try {
                let res: any = await deleteQualificationApi(param);
                if (res.success) {
                    getData();
                }
            } catch (err) {
                return;
            }
        })
        .catch(() => {
            ElMessage({
                type: 'info',
                message: '取消删除',
            });
        });
};

//#region  附件上传下载
const fileInfo = ref();
const fileDialog = ref(false);
/*** cancelFileClick 文件上传取消事件 */
const cancelFileClick = (val: boolean) => {
    fileDialog.value = val;
};

/*** controlFileClick 文件上传提交事件 */
const controlFileClick = () => {
    fileDialog.value = false;
};

/*** documentClick 文档下载事件 */
const documentClick = async (val: any) => {
    console.log(val);
    val.sourceId = val.l_FileId
    val.sourceType = 11
    fileInfo.value = JSON.stringify(val);
    fileDialog.value = true;
};
//#endregion

//导出EXCEL
const excelRef: any = ref(null);
const handleExport = () => {
    if (excelRef.value) {
        if (excelRef.value.data.length !== 0) {
            let tableExcel: any = [];
            let tableArr = excelRef.value.data;
            tableArr.map((item: any) => {
                let tableObj: any = {};
                tableObj['许可证类型名称'] = item.v_TypeName ? item.v_TypeName : '-';
                tableObj['许可证名称'] = item.v_Name ? item.v_Name : '-';
                tableObj['许可证编号'] = item.v_NO ? item.v_NO : '-';
                tableObj['资质等级'] = item.v_Gade ? item.v_Gade : '-';
                tableObj['许可范围'] = item.v_Scope ? item.v_Scope : '-';
                tableObj['发证机关'] = item.v_Authority ? item.v_Authority : '-';
                tableObj['发证日期'] = item.d_IssueDate ? item.d_IssueDate : '-';
                tableObj['有效期'] = item.d_ValidityDate ? item.d_ValidityDate : '-';
                tableObj['复审日期'] = item.d_ReviewDate ? item.d_ReviewDate : '-';
                tableObj['最后一次数据同步时间'] = item.d_LastDSTime ? item.d_LastDSTime : '-';
                tableObj['发起同步时间'] = item.d_InitiateDSTime ? item.d_InitiateDSTime : '-';
                tableObj['待同步至双控'] = item.isTobeDS ? '是' : '否';
                tableObj['备注'] = item.v_Remark ? item.v_Remark : '-';


                tableObj['创建人'] = item.createdUserName ? item.createdUserName : '-';
                tableObj['创建时间'] = item.createdTime ? item.createdTime : '-';
                tableObj['更新人'] = item.updatedUserName ? item.updatedUserName : '-';
                tableObj['更新时间'] = item.updatedTime ? item.updatedTime : '-';
                tableExcel.push(tableObj);
            });
            exportToExcel(tableExcel, '企业资质.xlsx');
        } else {
            ElMessage({
                type: 'error',
                message: '暂无数据导出',
            });
        }
    }
};

onMounted(async () => {
    await initInfoFun();
});

const { handleCurrentChange, pageSize, pageNo, handleSizeChange, totalRows, list, indexMethod, loading, getData } = getTableData(getQualificationPageListApi, {}, searchObj);
</script>
<style lang="scss">
@import '../style/public.scss';
</style>
<style scoped lang="scss">
#friend-merchant-manage {
    .box-f {
        :deep(.el-form-item__label) {
            padding: 0;
        }
    }

    :deep(.el-card__body) {
        height: 100%;
    }

    :deep(.el-card) {
        border: none !important;
    }

    .upload-demo {
        margin-left: 12px;
        margin-top: 2px;
    }

    ul {
        list-style: none;

        li {
            cursor: pointer;

            &:hover {
                color: red;
            }
        }
    }

    .icon-e {
        :deep(.el-icon) {
            margin-right: 0px !important;
        }
    }

    .upload-s {
        :deep(.el-upload--picture-card) {
            background-color: rgba(255, 255, 255, 0) !important;
        }
    }
}
</style>
